const pool = require('../utils/utils.js')

module.exports = async function(ctx, next) {
    var res = await new Promise((resolve, reject) => {
        pool.query('SELECT * FROM' + "`book` WHERE rankNum>0 AND isDelete=0", (err, result) => {
            if (err) {
                reject(err)
            } else {
                resolve(result)
            }
        })
    })
    ctx.body = res
    await next()
}